package com.javacoo.junit.generator.internal.data;

/**
 * 原始类型
 * <li>定义原始类型返回值</li>
 *
 * @author: duanyong@jccfc.com
 * @since: 2021/1/7 12:50
 */
public class PrimitiveType {
    public static String get(Class clazz) {
        String result = "null";
        if (!clazz.isPrimitive()) {
            if ("String".equals(clazz.getSimpleName())) {
                return "\"hello\"";
            }
            return result;
        }
        switch (clazz.getName()) {
            case "int":
            case "short":
            case "byte":
                result = "0";
                break;
            case "long":
                result = "0L";
                break;
            case "char":
                result = "'a'";
                break;
            case "float":
                result = "0.0f";
                break;
            case "double":
                result = "0.0d";
                break;
            case "boolean":
                result = "false";
                break;
            default:
                break;
        }

        return result;
    }
    public static String get(String className) {
        String result = "null";
        if ("String".equals(className)) {
            return "\"hello\"";
        }
        switch (className) {
            case "int":
            case "short":
            case "byte":
                result = "0";
                break;
            case "long":
                result = "0L";
                break;
            case "char":
                result = "'a'";
                break;
            case "float":
                result = "0.0f";
                break;
            case "double":
                result = "0.0d";
                break;
            case "boolean":
                result = "false";
                break;
            default:
                break;
        }

        return result;
    }
}
